package com.treasure.mall.zbq.common.base;

import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author wm
 */
@Data
@Builder
public class CalenderWeek {
    /**
     * 周标识,20191021-20191027
     */
    private String weekTag;
    /**
     * 周一0点
     */
    private LocalDateTime beginTime;
    /**
     * 下周一0点
     */
    private LocalDateTime endTime;

    public String getBeginDate() {
        return beginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
    }

    public String getEndDate() {
        return endTime.plusDays(-1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
    }

    public String getBeginTimeStr() {
        return beginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }

    public String getEndTimeStr() {
        return endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }
}